package com.sztz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sztz.entity.User;
import org.apache.ibatis.annotations.*;

/**
 * 用户信息Mapper
 * @author yzy
 * @date 2023/3/23 10:03
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    /***
     * 根据ID查询用户信息
     * @param userCode 用户登录账号
     * @return com.tzcloud.entity.User
     * @author yzy
     * @date 2023/3/23 10:04
     */
    @Select("select * from t_user where user_code = #{userCode} and status=1 and deleted=0 order by create_time desc limit 1")
    @Results({@Result(property = "roles", column = "id",many = @Many(select = "com.tzcloud.mapper.RoleMapper.selectByUserId"))})
    User selectByLoginCode(@Param("userCode") String userCode);
}
